<!-- 定义导航栏 -->


<div id="header_box" class="col-md-8 ">
    <header id="site-header">
        <div class="row">

            <div class="col-md-4 col-sm-5 col-xs-8 navbar-left">
                <div class="logo">
                    <a id="logo" href="{% url 'index' %}">菜根谭</a>
                </div>
            </div>


            <div class="col-md-8 col-sm-7 col-xs-4">
                <nav class="main-nav" role="navigation">
                    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                        <ul class="nav navbar-nav navbar-left">
                            <li class="cl-effect-11"><a href="{% url 'index' %}" data-hover="首页">首页</a></li>
                            <li class="cl-effect-11"><a href="full-width.html" data-hover="博客">博客</a></li>
                            <li class="cl-effect-11"><a href="about.html" data-hover="关于">关于</a></li>
                            <li class="cl-effect-11"><a href="contact.html" data-hover="联系">联系</a></li>
                        </ul>


                        <form action="{% url 'article:search' %}" class="navbar-form navbar-right">
                            {% csrf_token %}
                            <input name="wd" type="text" placeholder="搜索博文" class="form-control">
                            <button type="submit"><span class="glyphicon glyphicon-search"></span></button>
                        </form>

{#                        <form action="" class="col-md-3 form-inline " method="post">#}
{#                            {% csrf_token %}#}
{#                            <label for="search" class="sr-only">content</label>#}
{#                            <input type="search" class="form-control" name="search" placeholder="搜索文章..."#}
{#                                   style="width:120px">#}
{##}
{#                            <button type="submit" id="search">#}
{#                                <span class="glyphicon glyphicon-search" aria-hidden="true"></span>#}
{#                            </button>#}
{#                        </form>#}

                        <div class="pull-right clearfix">
                            <span>当前用户:{{ user|default:"" }}</span>
                        </div>
                        <div class="pull-right clearfix">
                            <ul class="list-inline">

                                <li><a href="{% url 'myaccount:login' %}?next={{ request.path }}">登录</a></li>
                                <li><a href="{% url 'myaccount:register' %}?next={{ request.path }}">注册</a></li>
                                <li><a href="{% url 'myaccount:logout' %}?next={{ request.path }}">注销</a></li>
                                <li>
                                    {% if user.is_authenticated %}
                                        <form action="" method="post" style="display: inline;">
                                            {% csrf_token %}
                                            <a href="{% url 'myaccount:user_delete' user.pk %}" class="del">删除用户</a>
                                            <button type="submit" style="display: inline">删除用户</button>
                                        </form>
                                    {% endif %}
                                </li>
                            </ul>
                            <a class="navbar-link" href="{% url 'article:add_article' %}">写文章</a>
                        </div>
                    </div>
                </nav>
            </div>
    </header>

    {% if messages %}
        {% for message in messages %}
            <div class="alert alert-{{ message.tags }} alert-dismissable" role="alert">
                <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                    {{ message }}
            </div>
        {% endfor %}
    {% endif %}
</div>

